package com.iweb.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller("helloController") // 标记当HelloController为前端控制器
public class HelloController {

    // 配置请求映射
    @RequestMapping("/hello")
    public ModelAndView hello(
            @RequestParam(value = "name") String name // 接收 ?name=admin
    ) {
        System.out.println(name);
        return new ModelAndView("main");
    }

}
